home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWNotifn / FWNotifr.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  2.9 KB  |  98 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWNotifr.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWFound.hpp"
  11.  
  12. #ifndef FWNOTIFR_H
  13. #include "FWNotifr.h"
  14. #endif
  15.  
  16. #ifndef FWRECEVR_H
  17. #include "FWRecevr.h"
  18. #endif
  19.  
  20. #ifndef FWNOTIFN_H
  21. #include "FWNotifn.h"
  22. #endif
  23.  
  24. #ifndef FWINTERE_H
  25. #include "FWIntere.h"
  26. #endif
  27.  
  28. #ifndef FWNOTDEF_H
  29. #include "FWNotDef.h"
  30. #endif
  31.  
  32. #ifndef FWINTSPC_H
  33. #include "FWIntSpc.h"
  34. #endif
  35.  
  36. #ifndef FWSOMENV_H
  37. #include "FWSOMEnv.h"
  38. #endif
  39.  
  40. //========================================================================================
  41. // CLASS FW_MNotifier
  42. //========================================================================================
  43.  
  44. FW_DEFINE_CLASS_M0(FW_MNotifier)
  45. FW_DEFINE_AUTO(FW_MNotifier)
  46.  
  47. //----------------------------------------------------------------------------------------
  48. // FW_MNotifier::FW_MNotifier
  49. //----------------------------------------------------------------------------------------
  50.  
  51. FW_MNotifier::FW_MNotifier() :
  52.     fNotifierID(0)
  53. {
  54. }
  55.  
  56. //----------------------------------------------------------------------------------------
  57. // FW_MNotifier::~FW_MNotifier
  58. //----------------------------------------------------------------------------------------
  59.  
  60. FW_MNotifier::~FW_MNotifier()
  61. {
  62.     FW_CPrivInterestSpace* interestSpace = FW_CPrivInterestSpace::Instance();
  63.     
  64.     // Notify the receivers that this notifier is being deleted
  65.     // (used for instance to remove a RadioCluster when all radio buttons are gone)
  66.     // Only receivers that have added an interest in this message will be notified
  67.     FW_SOMEnvironment ev;
  68.     interestSpace->Notify(ev, FW_CInterest(this, FW_kNotifierDeletedMsg));
  69.     interestSpace->RemoveNotifier(this);
  70. }
  71.     
  72. //----------------------------------------------------------------------------------------
  73. // FW_MNotifier::Notify
  74. //----------------------------------------------------------------------------------------
  75.  
  76. void FW_MNotifier::Notify(Environment* ev, const FW_CNotification ¬ification)
  77. {
  78.     FW_CPrivInterestSpace::Instance()->Notify(ev, notification);
  79. }
  80.  
  81. //----------------------------------------------------------------------------------------
  82. // FW_MNotifier::Notify
  83. //----------------------------------------------------------------------------------------
  84.  
  85. void FW_MNotifier::Notify(Environment* ev, FW_Message message)
  86. {
  87.     Notify(ev, FW_CInterest(this, message));
  88. }
  89.  
  90. //----------------------------------------------------------------------------------------
  91. // FW_MNotifier::IsConnectedTo
  92. //----------------------------------------------------------------------------------------
  93.  
  94. FW_Boolean FW_MNotifier::IsConnectedTo(FW_MReceiver* receiver, const FW_CInterest& interest)
  95. {
  96.     return (FW_CPrivInterestSpace::Instance()->HasInterest(receiver, interest));
  97. }
  98.